//
//  NSNumber+utils.m
//  helper
//
//  Created by huangyi on 12-11-14.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import "NSNumber+utils.h"

@implementation NSNumber (utils)

+(NSNumber*)numberWithString:(NSString*)string{
    @try {
        static NSNumberFormatter *formatter=nil;
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            formatter=[[NSNumberFormatter alloc] init];
            [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
        });
        NSNumber *number=[formatter numberFromString:string];
        return number;
    }
    @catch (NSException *exception) {
        NSLog(@"%@",exception.description);
        return nil;
    }
    @finally {
    }
}

@end
